//
//  ViewController.m
//  动态字体大小
//
//  Created by chenlishuang on 16/7/27.
//  Copyright © 2016年 chenlishuang. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *myLabel;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.myLabel.text = @"爱上了飞机垃圾费拉就是了房间爱老师放假啦手机费拉数据法拉盛解放啦手机费拉数据放垃圾来看手机";
    self.myLabel.numberOfLines = 0;
}


- (IBAction)BtnAction:(id)sender {
    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:@" " preferredStyle:UIAlertControllerStyleAlert];
    UISlider *slider = [[UISlider alloc]initWithFrame:CGRectMake(13, 40, 250, 30)];
    slider.minimumValue = 1;
    slider.maximumValue = 30;
    slider.value = self.myLabel.font.pointSize;
    [slider addTarget:self action:@selector(changeValue:) forControlEvents:UIControlEventValueChanged];
    [alertVC.view addSubview:slider];

    UIAlertAction *GODAlert = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
    }];
    UIAlertAction *GDHAlert = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    [alertVC addAction:GODAlert];
    [alertVC addAction:GDHAlert];
    [self presentViewController:alertVC animated:YES completion:nil];
}
- (void)changeValue:(UISlider *)sender{
    self.myLabel.font = [UIFont systemFontOfSize:sender.value];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
